<?php
/**
 * Created by PhpStorm.
 * User: tandunzhao
 * Date: 2018/5/28
 * Time: 下午3:17
 */

namespace App\Modules\Pay\Services;


use App\Modules\Pay\Models\PayMerchant;

class PayMerchantService
{


    /**
     * 更具ID查找
     * @param $payMerchantId
     * @return mixed
     */
    public static function get($payMerchantId) {
        return PayMerchant::find($payMerchantId);
    }

    /**
     * 获取一个支付通道
     * @return mixed
     */
    public static function getUsePayMerchantSource() {
        return PayMerchant::where('is_enabled', 1)
            ->where('is_use', 1)
            ->first();
    }


    /**
     * 获取默认官方支付通道配置
     * @return mixed
     */
    public static function getOfficialPayMerchantSource() {
        return PayMerchant::where('is_enabled', 1)
            ->where('source', 'OFFICIALPAY')
            ->first();
    }

    /**
     * 获取一个企业付款支付通道
     * @return mixed
     */
    public static function getCompanyPayPersonPayMerchantSource() {
        return PayMerchant::where('is_enabled', 1)
            ->where('source', 'OFFICIALPAY')
            ->first();
    }
}